package com.business.user.entity;

import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 用户表 实体类
 * @author chenjiehong
 * @date 2019-11-29 14:28:27
 * @since 1.0
 */
@TableName(value = "user")
public class User extends UserDto {

    // columns START

	@TableId(value = "id",type=IdType.AUTO)
	@JsonIgnore
	private Integer id;

	/**
	 * 手机号码
	 */
	private String phone;

	/**
	 * 密码
	 */
	@JsonIgnore
	private String password;

	/**
	 * 邮箱
	 */
	private String email;

	/**
	 * 用户来源平台 wechat：微信,qq
	 */
	@TableField(value = "open_source")
	@JsonIgnore
	private String openSource;

	/**
	 * 微信或者其他平台用户id
	 */
	@TableField(value = "open_id")
	private String openId;

	/**
	 * 微信对用户数据进行 加密签名 的密钥
	 */
	@TableField(value = "session_key")
	@JsonIgnore
	private String sessionKey;

	/**
	 * 状态 0：删除 1：正常  2：冻结
	 */
	private Integer state;

	/**
	 * 修改时间
	 */
	@TableField(value = "update_time")
	private Date updateTime;

	/**
	 * 创建时间
	 */
	@TableField(value = "create_time")
	private Date createTime;

	/**
	 * 最后登录时间
	 */
	@TableField(value = "last_login_time")
	private Date lastLoginTime;

	/**
	 * 0:默认 手机注册 1：其他平台注册
	 */
	@TableField(value = "register_type")
	@JsonIgnore
	private Integer registerType;
	// columns END

	@TableField(exist = false)
	private  String token;

	@Override
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(Integer id) {
		this.id = id;
	}

	@Override
	public String getPhone() {
		return phone;
	}

	@Override
	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Override
	public String getPassword() {
		return password;
	}

	@Override
	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public String getEmail() {
		return email;
	}

	@Override
	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public String getOpenSource() {
		return openSource;
	}

	@Override
	public void setOpenSource(String openSource) {
		this.openSource = openSource;
	}

	@Override
	public String getOpenId() {
		return openId;
	}

	@Override
	public void setOpenId(String openId) {
		this.openId = openId;
	}

	@Override
	public String getSessionKey() {
		return sessionKey;
	}

	@Override
	public void setSessionKey(String sessionKey) {
		this.sessionKey = sessionKey;
	}

	@Override
	public Integer getState() {
		return state;
	}

	@Override
	public void setState(Integer state) {
		this.state = state;
	}

	@Override
	public Date getUpdateTime() {
		return updateTime;
	}

	@Override
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Override
	public Date getCreateTime() {
		return createTime;
	}

	@Override
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Override
	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	@Override
	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	@Override
	public Integer getRegisterType() {
		return registerType;
	}

	@Override
	public void setRegisterType(Integer registerType) {
		this.registerType = registerType;
	}

	@Override
	public String getToken() {
		return token;
	}

	@Override
	public void setToken(String token) {
		this.token = token;
	}

	@Override
	public String toString() {
		String log = "";
		log += "[id:" + getId() + "]";
		log += "[phone:" + getPhone() + "]";
		log += "[email:" + getEmail() + "]";
		log += "[state:" + getState() + "]";
		log += "[updateTime:" + getUpdateTime() + "]";
		log += "[createTime:" + getCreateTime() + "]";
		log += "[lastLoginTime:" + getLastLoginTime() + "]";
		log += "[registerType:" + getRegisterType() + "]";
		return log;
	}
}